package com.waa.gulimall.product.feign;

import com.waa.gulimall.common.to.SkuReductionTo;
import com.waa.gulimall.common.to.SpuBoundTo;
import com.waa.gulimall.common.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient("gulimall-coupon")
@Component
public interface CouponFeignService {

/**
 * 1.CouponFeignService.saveSpuBounds(SpuBoundTo)
 *  1)@RequestBod将这个数据转换为json
 *  2(找到gulimail-coupon 服务，给coupon/spubounds/save发送请求
 *  将上一步转的json放到请求体位置，发送请求
 *  3）对方服务收到请求，请求体里面有json数据
 *  将请求体里面的json数据转换为相应的你所接收的对象，只要json数据 模型是兼容无需使用同一个to
 *  */
    @PostMapping("/coupon/spubounds/save")
    void saveSpuBounds(@RequestBody SpuBoundTo spuBoundTo);
    @PostMapping("/coupon/skufullreduction/saveinfo")
    void saveSpuReduction(@RequestBody SkuReductionTo skuReduction);
}
